<style>code{background-color: #ffc;}</style>
<p><b>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=31375">Bug 31375</a> - Web Inspector: breakpoints in named evals are not restored after a reload</b>

<ul>
<li><p>open this page with Web Inspector
<li><p>switch to the Scripts panel, enabling debug if required
<li><p>the available scripts in the select element should be:
<ul>
<li>(program): f1.js
<li>(program): f2.js
<li>bp-in-named-eval-after-reload.html
</ul>
<li><p>In <code>(program) f1.js</code>, set a breakpoint on the first
executable line of the function <code>f1()</code>, the invocation of <code>doNothing()</code>.
<li><p>In <code>(program) f2.js</code>, set a breakpoint on the first
executable line of the function <code>f2()</code>, the invocation of <code>doNothing()</code>.
<li><p>click this button: <input id=button type=button value="click me">
<li><p>debugger should stop in the <code>f1()</code> function.
<li><p>resume the debugger
<li><p>debugger should stop in the <code>f2()</code> function (the function in <code>(program) f2.js</code>)
<li><p>resume the debugger
<li><p>switch to the web page, reload the web page, switch back to web inspector
<li><p>in the breakpoints sidebar panel, click on the two breakpoints listed
and the source for those functions should be shown in the source panel, and
the previous breakpoint markers should be visible
<li><p>click the "click me" button above, again
<li><p>debugger should stop in the <code>f1()</code> function.
<li><p>resume the debugger
<li><p>debugger should stop in the <code>f2()</code> function.
<li><p>resume the debugger
</ul>

<p>Note that without the fix in <a href="https://bugs.webkit.org/show_bug.cgi?id=31375">Bug 31375</a>,
the breakpoints won't work after reloading the page.

<script>

function doNothing() { /* allows multi-line functions, easier to debug */ };

eval([
    "function f1() {",
    "   doNothing();",
    "   console.log(new Date() + ':  f1() called');",
    "}",
    "//# sourceURL=f1.js"
].join("\n"));

f2 = Function([
    "",
    "   doNothing();",
    "   console.log(new Date() + ':  f2() called');",
    "//# sourceURL=f2.js"
].join("\n"));

var button = document.getElementById("button");

button.addEventListener("click", clickHandler, false);

function clickHandler() {
    f1();
    f2();
}

</script>
<!-- End -->
